Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
How Create an event handler for event "resize"?

when alternating the display on the browser (F12) from mobile or responsive to desktop the div (content_filter) disappears.. refresh the page to fix the bug.

Desktop view

Desktop mode

from what I understand I need to add a Window: resize event to avoid refreshing each time. my level in javascript is completely beginner. can you show me the correct technique with my code?

<script>

        document.addEventListener('DOMContentLoaded', function () {
            jQuery(function ($) {

                $('.filter_btn').click(function (event) {
                    if (window.innerWidth <= 768) {
                        $('.content_filter').slideToggle('250', 'swing', 'hide');
                    }
                });
            });
        });
    </script>

    <style >
        @media all and(max - width: 768 px) {
            .content_filter {
                display: none;
            }
        } 
</style>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use:

window.addEventListener('resize', function () {
console.log(window.innerHeight);
});

check https://developer.mozilla.org/en-US/docs/Web/API/Window/resize_event for further informaion.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda